<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>主页</h1>
    <a href="javascript:void(0)" id="quit">退出</a>
    <script>

        if (sessionStorage.getItem("userInfo") == undefined) {
            location="./login.html";
        }else{
            //欢迎某某 
        }

        //退出功能
        document.getElementById('quit').onclick=function(){
            sessionStorage.clear();
            location="./login.html";
        }
    </script>
</body>

</html>